#include<iostream>
using namespace std;
int main()
{
	int n,num = 0;
	int arr[100],a[100];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			for (int k = 0; k < n; k++)
			{
				if (arr[k] == arr[i] + arr[j] && a[k] == 0)
				{
					num++;
					a[k] = 1;
				}
			}
		}
	}
	cout << num;
	return 0;
}